fix: resolve cross-package test and type failures#33
Open
stooit wants to merge 1 commit into
Open
Conversation
- ui: register happy-dom in root bunfig preload so root-level bun test injects DOM globals - ui(Button): wire declared aria-label prop onto rendered button element - ui(DataTable): fix stale-closure in sort toggle via functional state updater - utils(date): format en-AU as D/MM/YYYY (4-digit year) instead of zero-padded numeric - web(api): update import/re-export for renamed useThrottle -> useDebounce hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing
bun testcases andnpx tsc --noEmitsource type errors across the monorepo. Final state: 13/13 tests pass, 0 source type errors. No test files modified, no dependencies added.Bugs fixed
DOM test environment not applied at repo root (
bunfig.toml)Root-level
bun testsetenvironment = "happy-dom"but never preloaded the setup script that injects DOM globals, so UI component tests failed withReferenceError: document is not defined. Addedpreload = ["./packages/ui/test/setup.ts"]to the root config (andenvironment = "happy-dom"topackages/ui/bunfig.toml) soGlobalRegistrator.register()runs regardless of where tests are invoked.Missing accessibility attribute (
packages/ui/src/components/Button/Button.tsx)The
aria-labelprop was declared but never applied to the rendered<button>. Destructured and forwarded it.Stale-closure bug in sort toggle (
packages/ui/src/components/DataTable/DataTable.tsx)handleSortreadsortDirfrom the closure. Switched to the functional updater form so the controlled re-render test passes.Wrong date format (
packages/utils/src/format/date.ts)en-AUformatting produced zero-padded / 2-digit-year output. Reworked to emit day-first with a 4-digit year (D/MM/YYYY), satisfying both the tests and the documented contract.Renamed hook still imported under old name (
apps/web/src/lib/api.ts)useThrottlewas renamed touseDebouncein@e2e/utils. Updated the import and re-export (keeping theuseSearchDebouncealias).Verification
bun test(from repo root): 13 pass, 0 failnpx tsc --noEmit: no source type errors (only pre-existingbun:testmodule-resolution noise in test files, which were not modified)Assumptions
Cannot find module 'bun:test'tsc errors originate in test files and are pre-existing environmental noise; per the constraint not to modify test files, these were left untouched.